package com.kaishengit.web;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.kaishengit.entity.User;
import com.kaishengit.entity.Project;
import com.kaishengit.service.ProjectService;
import com.kaishengit.service.UserService;

public class NewGoalView extends HttpServlet {

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		
		
		request.setCharacterEncoding("UTF-8");
		
		String projectname = request.getParameter("project");
		if(projectname!=null) {
			request.setAttribute("project", projectname);
		}
		
		String state = request.getParameter("state");
		
		request.setAttribute("state", state);
		
		ProjectService projectService = new ProjectService();
		
		List<Project> listproject= projectService.findAll();
		
		request.setAttribute("listproject", listproject);
		
		
		
		UserService userService = new UserService();
		
		List<User> list = userService.findAll();
		request.setAttribute("list", list);
		
		
		request.getRequestDispatcher("WEB-INF/views/newgoal.jsp").forward(request, response);
	}

}
